from django.contrib import admin
from .models import GroupModel, GroupMembersModel, MessageModel


# Register your models here.
class GroupAdmin(admin.ModelAdmin):
    list_display = ['name']
    list_display_links = ['name']


class GroupMembersAdmin(admin.ModelAdmin):
    list_display = ['group', 'user', 'upload', 'view']
    list_display_links = ['group', 'user', 'upload', 'view']


class MessageAdmin(admin.ModelAdmin):
    list_display = ['content', 'label1', 'label2','uploader']
    list_display_links = ['content', 'label1', 'label2','uploader']
    readonly_fields = ['create_time']
    def uploader(self, obj):
        return obj.uploader.first_name


admin.site.register(GroupModel, GroupAdmin)
admin.site.register(GroupMembersModel, GroupMembersAdmin)
admin.site.register(MessageModel, MessageAdmin)
